package com.settlement.system.service.impl;

import com.settlement.system.mapper.TblWpItemDiffSourceMapper;
import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.TblWpItemDiffSource;
import com.settlement.system.service.ITblWpItemDiffSourceService;
import org.springframework.stereotype.Service;
import com.settlement.system.mapper.BaseMapper;
import jakarta.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 唯品会差异明细 服务实现类
 * @author Ximi
 * @since 2020-04-17
 */
@Service
public class TblWpItemDiffSourceServiceImpl extends BaseServiceImpl implements ITblWpItemDiffSourceService {

    @Resource
    private TblWpItemDiffSourceMapper tblWpItemDiffSourceMapper;

    @Override
    public BaseMapper init() {
        return tblWpItemDiffSourceMapper;
    }

    /**
     * 获取合计
     * @param params
     * @return
     * @throws ServiceException
     */
    @Override
    public TblWpItemDiffSource selectFoot(Map<String, Object> params) throws ServiceException {
        try {
            return tblWpItemDiffSourceMapper.selectFoot(params);
        } catch (Exception ex){
            throw  new ServiceException("唯品会差异明细合计异常",ex);
        }
    }

    /**
     * 随机获取一条差异明细
     * @param billNumber
     * @return
     * @throws ServiceException
     */
    @Override
    public TblWpItemDiffSource getRandomItemDiffSource(String billNumber) throws ServiceException {
        try {
            return tblWpItemDiffSourceMapper.getRandomItemDiffSource(billNumber);
        } catch (Exception ex){
            throw  new ServiceException("随机获取一条差异明细异常",ex);
        }
    }

    /**
     * 查询 列表中 非【衣酷】 的数据有多少条
     * @param idList
     * @return
     * @throws ServiceException
     */
    @Override
    public int selectCountNotYk(List<String> idList, String toBeDeletedScheduleId) throws ServiceException {
        try {
            return tblWpItemDiffSourceMapper.selectCountNotYk(idList,toBeDeletedScheduleId);
        } catch (Exception e) {
            throw new ServiceException(e);
        }
    }

}

